﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
             xmlns:cal="http://www.caliburnproject.org"
             xmlns:ctrl="clr-namespace:MediaOwl.Common.ControlTemplates;assembly=MediaOwl.Common"
             x:Class="MediaOwl.LastFm.Views.MusicTrackHomeView"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="400">
    <UserControl.Resources>

        <DataTemplate x:Key="TrackItemTemplate">
            <Border CornerRadius="3"
                    Background="{StaticResource DarkInnerShadowDarkBrush}"
                    Width="350"
                    Height="95">
                <Grid Margin="5"
                      Width="340"
                      Height="75">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition Height="22" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Rectangle Fill="{StaticResource TreeViewItemSelectionBorder}"
                               Stroke="{StaticResource ColorAccentBrush}"
                               Grid.RowSpan="3"
                               Width="75"
                               Height="75"
                               d:LayoutOverrides="GridBox" />
                    <TextBlock TextWrapping="Wrap"
                               Text="No Image"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Center"
                               Foreground="{StaticResource ControlForeground}"
                               Grid.RowSpan="3" />
                    <Image Source="{Binding Picture}"
                           Width="75"
                           Height="75"
                           Grid.RowSpan="3"
                           d:LayoutOverrides="GridBox" />
                    <TextBlock TextWrapping="Wrap"
                               Text="{Binding Name}"
                               Style="{StaticResource Heading3}"
                               Foreground="{StaticResource ControlForeground}"
                               Grid.Column="1"
                               Margin="10,0,0,3"
                               FontSize="18.667" />
                    <TextBlock Text="{Binding ArtistName}"
                               Style="{StaticResource Heading5}"
                               Foreground="{StaticResource ControlForeground}"
                               Grid.Column="1"
                               Margin="10,0,0,0"
                               Grid.Row="2"
                               FontSize="13.333"
                               FontWeight="Bold" />
                </Grid>
            </Border>
        </DataTemplate>
    </UserControl.Resources>
    <ctrl:WorkitemControl BusyContext="{Binding CurrentBusyViewModel}"
                          DialogContext="{Binding ActiveDialog}">
        <toolkit:DockPanel Margin="5">

            <toolkit:DockPanel LastChildFill="False"
                               Margin="0,0,0,5"
                               toolkit:DockPanel.Dock="Top">
                <TextBlock x:Name="DisplayName"
                           TextWrapping="Wrap"
                           toolkit:DockPanel.Dock="Top"
                           Style="{StaticResource Heading2}"
                           Margin="0,0,0,10" />
                <TextBlock x:Name="SearchResultText"
                           Foreground="{StaticResource ControlForeground}"
                           MinHeight="20"
                           Margin="0,2,0,0"
                           toolkit:DockPanel.Dock="Bottom" />
                <StackPanel Margin="0,0,5,0">
                    <TextBox x:Name="SearchText"
                             TextWrapping="Wrap"
                             MinWidth="150"
                             d:LayoutOverrides="Width">
                        <i:Interaction.Triggers>
                            <ei:KeyTrigger Key="Enter">
                                <cal:ActionMessage MethodName="SearchShortCut" />
                            </ei:KeyTrigger>
                        </i:Interaction.Triggers>
                    </TextBox>
                    <TextBlock TextWrapping="Wrap"
                               Text="Required: Track" />
                </StackPanel>
                <StackPanel Margin="0,0,5,0">
                    <TextBox x:Name="SearchText2"
                             TextWrapping="Wrap"
                             MinWidth="150"
                             d:LayoutOverrides="Width">
                        <i:Interaction.Triggers>
                            <ei:KeyTrigger Key="Enter">
                                <cal:ActionMessage MethodName="SearchShortCut" />
                            </ei:KeyTrigger>
                        </i:Interaction.Triggers>
                    </TextBox>
                    <TextBlock TextWrapping="Wrap"
                               Text="Optional: Artist" />
                </StackPanel>
                <Button x:Name="SearchItems"
                        Content="Search"
                        Margin="0,0,10,0"
                        VerticalAlignment="Top" />
                <StackPanel Orientation="Horizontal"
                            HorizontalAlignment="Right"
                            toolkit:DockPanel.Dock="Right">
                    <Button x:Name="Previous"
                            Content="Previous"
                            d:LayoutOverrides="Height"
                            Margin="0,0,10,0"
                            VerticalAlignment="Top" />
                    <Button x:Name="Next"
                            Content="Next"
                            d:LayoutOverrides="Height"
                            Margin="0"
                            VerticalAlignment="Top" />
                </StackPanel>
            </toolkit:DockPanel>
            <ListBox x:Name="Tracks"
                     ItemTemplate="{StaticResource TrackItemTemplate}"
                     d:LayoutOverrides="Height"
                     ItemsPanel="{StaticResource WrappingItemsPanelTemplate}"
                     Background="{x:Null}"
                     ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                     SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <cal:ActionMessage MethodName="Open" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </ListBox>

        </toolkit:DockPanel>
    </ctrl:WorkitemControl>
</UserControl>
